#include<iostream>
#include<cmath> 
using namespace std;
int main(){
    int n,a,A1=0,A2=0,A3=0,A4=0,A5=0,flag=0,cnt=0,num=2;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a;
        if(a%10==0) A1+=a;
        if(a%5==1){
            A2+=pow(-1,num)*a;
            flag=1;
            num++;
        }
        if(a%5==2) A3++;
        if(a%5==3){
        	A4+=a;
        	cnt++;
		} 
        if(a%5==4)
            if(a>A5) A5=a;
    }
    if(A1==0) cout<<"N"<<" ";
    else cout<<A1<<" ";
    if(flag==0) cout<<"N"<<" ";
    else cout<<A2<<" ";
    if(A3==0) cout<<"N"<<" ";
    else cout<<A3<<" ";
    if(A4==0) cout<<"N"<<" ";
    else printf("%.1lf ",(float)A4/cnt);
    if(A5==0) cout<<"N";
    else cout<<A5;
    return 0;
}
